#include "StdAfx.h"
#include "AnimationRotateRoundUpSpin.h"

CAnimationRotateRoundUpSpin::CAnimationRotateRoundUpSpin(void)
{
	m_time = 0;
	m_increment = 0;
}

CAnimationRotateRoundUpSpin::~CAnimationRotateRoundUpSpin(void)
{
}

void CAnimationRotateRoundUpSpin::Update(void)
{
	m_time++;
	m_time %= 200;

	if((m_time >= 3) && (m_time < 25))
		m_increment += 3;

	else if((m_time >= 25) && (m_time < 170))
		m_increment = 67;

	else if((m_time >= 170) && (m_time < 192))
		m_increment -= 3;

	// get the ride back to the entrance, 
	// find the difference from the entrance and increment towards it
	else if((m_time >= 192) && (m_time < 197))
		m_increment = -5;
	else if(m_time == 198)
	{
		m_increment = 0;
		m_node->SetAngle(0);
	}
	else
		m_increment = 0;

	m_node->SetAngle(m_node->GetAngle() + m_increment);
}